function gpsLocation() {
    var map = new AMap.Map("mapGD", { resizeEnable: true, zoom: 16 });
    if (!RssOS.isrssapp) {
        map.plugin('AMap.Geolocation', function () {
            var geolocation = new AMap.Geolocation({
                enableHighAccuracy: true,
                timeout: 10000,
                buttonOffset: new AMap.Pixel(10, 20),
                zoomToAccuracy: true,
                buttonPosition: 'RT'
            })

            geolocation.getCurrentPosition();
            AMap.event.addListener(geolocation, 'complete', onComplete);
            AMap.event.addListener(geolocation, 'error', onError);

            function onComplete(data) {

                var lnglat = data.position, addressComponent = data["addressComponent"];
                lnglat["citycode"] = addressComponent["citycode"];
                JsAdapter.onLocationReceive(lnglat)
            }

            function onError(data) {
                JsAdapter.onLocationReceiveFail();
            }
        })
    }
    //个人当前位置标点
    JsAdapter.onLocationReceive = function (data) {
        alert(data.address);
        $('.gpslocation').text(data.address);
        $('input[name=gpslocation]').val(data.address);
        $('input[name=lng]').val(data.lng);
        $('input[name=lat]').val(data.lat);
        var lnglat = new AMap.LngLat(data["lng"], data["lat"]);
        map.setCenter(lnglat);
        var marker = new AMap.Marker({
            position: [lnglat.lng, lnglat.lat]
        })
        map.add(marker);

    }
    JsAdapter.onLocationReceiveFail = function () {
        alert("获取您的微信信息出错，请检查是否已开启定位？");
    }
    JsAdapter.LocationListener({ "once": 1 }).Submit();
}
function gpsLocationFabu() {
    var map = new AMap.Map("mapGD", { resizeEnable: true, zoom: 16 });
    if (!RssOS.isrssapp) {
        map.plugin('AMap.Geolocation', function () {
            var geolocation = new AMap.Geolocation({
                enableHighAccuracy: true,
                timeout: 10000,
                buttonOffset: new AMap.Pixel(10, 20),
                zoomToAccuracy: true,
                buttonPosition: 'RT'
            })

            geolocation.getCurrentPosition();
            AMap.event.addListener(geolocation, 'complete', onComplete);
            AMap.event.addListener(geolocation, 'error', onError);

            function onComplete(data) {

                var lnglat = data.position, addressComponent = data["addressComponent"];
                lnglat["citycode"] = addressComponent["citycode"];
                JsAdapter.onLocationReceive(lnglat)
            }

            function onError(data) {
                JsAdapter.onLocationReceiveFail();
            }
        })
    }
    //个人当前位置标点
    JsAdapter.onLocationReceive = function (data) {
        alert(data.address);
        $('.gpslocation').text(data.address);
        $('input[name=location]').val(data.address);
        $('input[name=lng]').val(data.lng);
        $('input[name=lat]').val(data.lat);
        var lnglat = new AMap.LngLat(data["lng"], data["lat"]);
        map.setCenter(lnglat);
        var marker = new AMap.Marker({
            position: [lnglat.lng, lnglat.lat]
        })
        map.add(marker);

    }
    JsAdapter.onLocationReceiveFail = function () {
        alert("获取您的微信信息出错，请检查是否已开启定位？");
    }
    JsAdapter.LocationListener({ "once": 1 }).Submit();
}
function showShebei() {
    window.location.hash = '#map';
    RssApi.Table.Query("zhaojixie").condition({ "rssdistance": $('input[name=lng]').val() + "," + $('input[name=lat]').val() + ",lng,lat|{lt~" + 25000 + "}" }).getJson(function (data) {
        alert(JSON.stringify(data), 'data');
        $.each(data, function (idx, rows) {
            var marker = new AMap.Marker({ position: [rows["lng"], rows["lat"]], "content": '<ul class="mapmarker all"><li>' + rows["nickname"] + '</li></ul>' });
            map.add(marker);
        });
        map.setFitView();
    });
}
var map = new AMap.Map('mapGD', {resizeEnable: true,zoom: 16});
